const connection = require("../db/connection")

function selectAll() {
    connection.query("select * from sp", function (error, qbsp) {
        if (error) {
            console.log("列出全部商品信息失败", error);
            process.exit(1)
        }
        if (qbsp.length <= 0) {
            console.log("商品信息为空");
            process.exit(1)
        }
        for (let sp of qbsp) {
            for (let [k, v] of Object.entries(sp)) {
                process.stderr.write(`${k}: ${v} \t`)
            }
            console.log();
        }
        connection.end()
    }
    )
}





module.exports = selectAll